package DesignPatern.A18_备忘录模式.A02_抽象模式;

/**
 * @Author: Du
 * @Date: 2021/8/3 14:23
 * 使用状态的类
 */
public class Originator
{
    private String state = "";
    
    public String getState()
    {
        return state;
    }
    
    public void setState(String state)
    {
        this.state = state;
    }
    
    public Memento createMemento()
    {
        return new Memento(this.state);
    }
    
    public void restoreMemento(Memento memento)
    {
        this.setState(memento.getState());
    }
}
